export const focus = {
  inserted: function(dom, options) {
    dom.focus()
  }
}
export const imageError = {
  inserted: function(dom, options) {
    console.log('图片加载失败')

    dom.onerror = function() {
      dom.src = options.value
    }
  }
}

import store from '@/store'
// 按钮级别权限，没有就设置为隐藏，有就设置为显示
export const allow = {
  inserted: function(dom, options) {
    const points = store.state.user.userInfo.roles.points
    if (!points.includes(options.value)) {
      dom.style.display = 'none'
    }
  }
}
